<template>
	<view class="content">
		<nav-bars title="收款" isBack backColor="#fff" color="#fff" background="#333333"></nav-bars>
		<view class="head">
			<view class="tag" :style="{background:'url('+tag_bg+')',backgroundSize:'cover'}">
				<text>POS机收款</text>
			</view>
			<view class="main">
				<view class="title">请用POS机扫描二维码</view>
				<view class="money">￥{{amount}}</view>
				<view class="qrcode">
					<canvas id="myQrcode" canvas-id="myQrcode"></canvas>
				</view>
			</view>
		<view class="footer">
			<view class="fundSource" @click="goSkip('/pagesFour/posPayment/balance/recordList')">
				<image src="@/static/images/stream.png"></image>
				<text>查看收支明细</text>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	// const qrCode = require('@/utils/weapp-qrcode.js')
	import uQRCode from '@/components/uqrcode/common/uqrcode.js'
	export default {
		data() {
			return {
               tag_bg:this.$static+'/static/pos/withdrawal_bg.png',
			   amount:0.00,
			   baseImg:this.$static,
			}
		},
		onLoad(options) {
              this.amount = options.amount
			  this.verificationCode = options.verificationCode
			  // this.initQrCode()
		},
		methods: {
			// initQrCode(){
			// 	new qrCode('myQrcode', {
			// 		text: this.verificationCode,
			// 		width: 157,
			// 		height: 157,
			// 		colorDark: "#333333",
			// 		colorLight: "#FFFFFF",
			// 		correctLevel: qrCode.CorrectLevel.H
			// 	})
			// },
			onReady() {
			    uQRCode.make({
			        canvasId: 'myQrcode',
			        componentInstance: this,
			        size: 150,
			        margin: 14,
			        text: this.verificationCode,
			        backgroundColor: '#ffffff',
			        foregroundColor: '#333333',
			        fileType: 'png',
			        errorCorrectLevel: uQRCode.errorCorrectLevel.H
			    })
			    .then(res => {
			        console.log(res)
			    })
			  },
            goSkip(url){
				uni.navigateTo({
					url:url
				})
			},
			//跳转支付详情
			paymentDateil(e){
				if(e==1){
					//支付成功
					uni.navigateTo({
						url:'/pagesFour/posPayment/paySuccess'
					})
				}else{
					uni.navigateTo({
						url:'/pages/posPayment/payFail'
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		.head {
			width: 98%;
			margin: auto;
			margin-top:20rpx;
			.tag {
				width:100%;
				height:120rpx;
				line-height: 120rpx;
				text-indent:30rpx;
				z-index: 100;
				text{
					color: #fff;
				}
			}
			
		}
		.main{
			width: 100%;
			padding-top: 100rpx;
			text-align: center;
			.title{
				color: #515152;
			}
			.money{
				padding-top: 80rpx;
				color: #242424;
				font-size: 54rpx;
				font-weight: bold;
			}
			.qrcode{
				margin:59rpx auto;
				// image{
				// 	width:314rpx;
				// 	height: 314rpx;
				// }
				canvas{
					width:340rpx;
					height: 340rpx;
					margin: auto;
				}
			}
		}
		.footer{
			padding:30rpx;
			margin-top: 98rpx;
			.fundSource{
				display: flex;
				align-items: center;
				image{
					width: 34rpx;
					height: 34rpx;
					margin-right: 6rpx;
				}
				text{
					color: #242424;
				}
			}
		}
	}
</style>
